<div class="photo_thumbnail">
    <?php $user = new ORM('user'); $user->find($photo->owner); ?>
    <!-- The photo -->
    <a href="<?php echo URL::site("photo/view/$photo->category_id/$photo->id?uid=$user->id"); ?>">
        <img class="thumb" alt="" src="<?php echo URL::base_url() . $photo->link ?>" />
    </a>

    <!-- The username and category -->
    <div class="uploader_name">by 
        <a href="<?php echo URL::site("profile?uid=$user->id") ?>">
            <?php echo $user->username; ?>
        </a>
    </div>

    <!-- Cartegory -->
    <?php $categ = new ORM('photo_category'); $categ->find($photo->category_id); ?>
    <div class="categ_name">in <?php echo $categ->name; ?></div>
</div>
